<?php include_once "usuariosinfo.php" ?>
<?php

// Create page object
if (!isset($galeriaximagenes_grid)) $galeriaximagenes_grid = new cgaleriaximagenes_grid();

// Page init
$galeriaximagenes_grid->Page_Init();

// Page main
$galeriaximagenes_grid->Page_Main();

// Global Page Rendering event (in userfn*.php)
Page_Rendering();

// Page Rendering event
$galeriaximagenes_grid->Page_Render();
?>
<?php if ($galeriaximagenes->Export == "") { ?>
<script type="text/javascript">

// Page object
var galeriaximagenes_grid = new ew_Page("galeriaximagenes_grid");
galeriaximagenes_grid.PageID = "grid"; // Page ID
var EW_PAGE_ID = galeriaximagenes_grid.PageID; // For backward compatibility

// Form object
var fgaleriaximagenesgrid = new ew_Form("fgaleriaximagenesgrid");
fgaleriaximagenesgrid.FormKeyCountName = '<?php echo $galeriaximagenes_grid->FormKeyCountName ?>';

// Validate form
fgaleriaximagenesgrid.Validate = function() {
	if (!this.ValidateRequired)
		return true; // Ignore validation
	var $ = jQuery, fobj = this.GetForm(), $fobj = $(fobj);
	this.PostAutoSuggest();
	if ($fobj.find("#a_confirm").val() == "F")
		return true;
	var elm, felm, uelm, addcnt = 0;
	var $k = $fobj.find("#" + this.FormKeyCountName); // Get key_count
	var rowcnt = ($k[0]) ? parseInt($k.val(), 10) : 1;
	var startcnt = (rowcnt == 0) ? 0 : 1; // Check rowcnt == 0 => Inline-Add
	var gridinsert = $fobj.find("#a_list").val() == "gridinsert";
	for (var i = startcnt; i <= rowcnt; i++) {
		var infix = ($k[0]) ? String(i) : "";
		$fobj.data("rowindex", infix);
		var checkrow = (gridinsert) ? !this.EmptyRow(infix) : true;
		if (checkrow) {
			addcnt++;
			elm = this.GetElements("x" + infix + "_gal_gal_id");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($galeriaximagenes->gal_gal_id->FldCaption()) ?>");
			felm = this.GetElements("x" + infix + "_gal_img");
			elm = this.GetElements("fn_x" + infix + "_gal_img");
			if (felm && elm && !ew_HasValue(elm))
				return this.OnError(felm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($galeriaximagenes->gal_img->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_gal_des");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($galeriaximagenes->gal_des->FldCaption()) ?>");
			elm = this.GetElements("x" + infix + "_gal_pub[]");
			if (elm && !ew_HasValue(elm))
				return this.OnError(elm, ewLanguage.Phrase("EnterRequiredField") + " - <?php echo ew_JsEncode2($galeriaximagenes->gal_pub->FldCaption()) ?>");

			// Set up row object
			ew_ElementsToRow(fobj);

			// Fire Form_CustomValidate event
			if (!this.Form_CustomValidate(fobj))
				return false;
		} // End Grid Add checking
	}
	return true;
}

// Check empty row
fgaleriaximagenesgrid.EmptyRow = function(infix) {
	var fobj = this.Form;
	if (ew_ValueChanged(fobj, infix, "gal_gal_id", false)) return false;
	if (ew_ValueChanged(fobj, infix, "gal_img", false)) return false;
	if (ew_ValueChanged(fobj, infix, "gal_des", false)) return false;
	if (ew_ValueChanged(fobj, infix, "gal_pub[]", false)) return false;
	return true;
}

// Form_CustomValidate event
fgaleriaximagenesgrid.Form_CustomValidate = 
 function(fobj) { // DO NOT CHANGE THIS LINE!

 	// Your custom validation code here, return false if invalid. 
 	return true;
 }

// Use JavaScript validation or not
<?php if (EW_CLIENT_VALIDATE) { ?>
fgaleriaximagenesgrid.ValidateRequired = true;
<?php } else { ?>
fgaleriaximagenesgrid.ValidateRequired = false; 
<?php } ?>

// Dynamic selection lists
fgaleriaximagenesgrid.Lists["x_gal_gal_id"] = {"LinkField":"x_gal_id","Ajax":true,"AutoFill":false,"DisplayFields":["x_gal_img_pri","","",""],"ParentFields":[],"FilterFields":[],"Options":[]};

// Form object for search
</script>
<?php } ?>
<?php if ($galeriaximagenes->getCurrentMasterTable() == "" && $galeriaximagenes_grid->ExportOptions->Visible()) { ?>
<div class="ewListExportOptions"><?php $galeriaximagenes_grid->ExportOptions->Render("body") ?></div>
<?php } ?>
<?php
if ($galeriaximagenes->CurrentAction == "gridadd") {
	if ($galeriaximagenes->CurrentMode == "copy") {
		$bSelectLimit = EW_SELECT_LIMIT;
		if ($bSelectLimit) {
			$galeriaximagenes_grid->TotalRecs = $galeriaximagenes->SelectRecordCount();
			$galeriaximagenes_grid->Recordset = $galeriaximagenes_grid->LoadRecordset($galeriaximagenes_grid->StartRec-1, $galeriaximagenes_grid->DisplayRecs);
		} else {
			if ($galeriaximagenes_grid->Recordset = $galeriaximagenes_grid->LoadRecordset())
				$galeriaximagenes_grid->TotalRecs = $galeriaximagenes_grid->Recordset->RecordCount();
		}
		$galeriaximagenes_grid->StartRec = 1;
		$galeriaximagenes_grid->DisplayRecs = $galeriaximagenes_grid->TotalRecs;
	} else {
		$galeriaximagenes->CurrentFilter = "0=1";
		$galeriaximagenes_grid->StartRec = 1;
		$galeriaximagenes_grid->DisplayRecs = $galeriaximagenes->GridAddRowCount;
	}
	$galeriaximagenes_grid->TotalRecs = $galeriaximagenes_grid->DisplayRecs;
	$galeriaximagenes_grid->StopRec = $galeriaximagenes_grid->DisplayRecs;
} else {
	$bSelectLimit = EW_SELECT_LIMIT;
	if ($bSelectLimit) {
		$galeriaximagenes_grid->TotalRecs = $galeriaximagenes->SelectRecordCount();
	} else {
		if ($galeriaximagenes_grid->Recordset = $galeriaximagenes_grid->LoadRecordset())
			$galeriaximagenes_grid->TotalRecs = $galeriaximagenes_grid->Recordset->RecordCount();
	}
	$galeriaximagenes_grid->StartRec = 1;
	$galeriaximagenes_grid->DisplayRecs = $galeriaximagenes_grid->TotalRecs; // Display all records
	if ($bSelectLimit)
		$galeriaximagenes_grid->Recordset = $galeriaximagenes_grid->LoadRecordset($galeriaximagenes_grid->StartRec-1, $galeriaximagenes_grid->DisplayRecs);
}
$galeriaximagenes_grid->RenderOtherOptions();
?>
<?php $galeriaximagenes_grid->ShowPageHeader(); ?>
<?php
$galeriaximagenes_grid->ShowMessage();
?>
<table class="ewGrid"><tr><td class="ewGridContent">
<div id="fgaleriaximagenesgrid" class="ewForm form-horizontal">
<div id="gmp_galeriaximagenes" class="ewGridMiddlePanel">
<table id="tbl_galeriaximagenesgrid" class="ewTable ewTableSeparate">
<?php echo $galeriaximagenes->TableCustomInnerHtml ?>
<thead><!-- Table header -->
	<tr class="ewTableHeader">
<?php

// Render list options
$galeriaximagenes_grid->RenderListOptions();

// Render list options (header, left)
$galeriaximagenes_grid->ListOptions->Render("header", "left");
?>
<?php if ($galeriaximagenes->gal_id->Visible) { // gal_id ?>
	<?php if ($galeriaximagenes->SortUrl($galeriaximagenes->gal_id) == "") { ?>
		<td><div id="elh_galeriaximagenes_gal_id" class="galeriaximagenes_gal_id"><div class="ewTableHeaderCaption"><?php echo $galeriaximagenes->gal_id->FldCaption() ?></div></div></td>
	<?php } else { ?>
		<td><div><div id="elh_galeriaximagenes_gal_id" class="galeriaximagenes_gal_id">
			<div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><?php echo $galeriaximagenes->gal_id->FldCaption() ?></span><span class="ewTableHeaderSort"><?php if ($galeriaximagenes->gal_id->getSort() == "ASC") { ?><span class="caret ewSortUp"></span><?php } elseif ($galeriaximagenes->gal_id->getSort() == "DESC") { ?><span class="caret"></span><?php } ?></span></div>
        </div></div></td>
	<?php } ?>
<?php } ?>		
<?php if ($galeriaximagenes->gal_gal_id->Visible) { // gal_gal_id ?>
	<?php if ($galeriaximagenes->SortUrl($galeriaximagenes->gal_gal_id) == "") { ?>
		<td><div id="elh_galeriaximagenes_gal_gal_id" class="galeriaximagenes_gal_gal_id"><div class="ewTableHeaderCaption"><?php echo $galeriaximagenes->gal_gal_id->FldCaption() ?></div></div></td>
	<?php } else { ?>
		<td><div><div id="elh_galeriaximagenes_gal_gal_id" class="galeriaximagenes_gal_gal_id">
			<div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><?php echo $galeriaximagenes->gal_gal_id->FldCaption() ?></span><span class="ewTableHeaderSort"><?php if ($galeriaximagenes->gal_gal_id->getSort() == "ASC") { ?><span class="caret ewSortUp"></span><?php } elseif ($galeriaximagenes->gal_gal_id->getSort() == "DESC") { ?><span class="caret"></span><?php } ?></span></div>
        </div></div></td>
	<?php } ?>
<?php } ?>		
<?php if ($galeriaximagenes->gal_img->Visible) { // gal_img ?>
	<?php if ($galeriaximagenes->SortUrl($galeriaximagenes->gal_img) == "") { ?>
		<td><div id="elh_galeriaximagenes_gal_img" class="galeriaximagenes_gal_img"><div class="ewTableHeaderCaption"><?php echo $galeriaximagenes->gal_img->FldCaption() ?></div></div></td>
	<?php } else { ?>
		<td><div><div id="elh_galeriaximagenes_gal_img" class="galeriaximagenes_gal_img">
			<div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><?php echo $galeriaximagenes->gal_img->FldCaption() ?></span><span class="ewTableHeaderSort"><?php if ($galeriaximagenes->gal_img->getSort() == "ASC") { ?><span class="caret ewSortUp"></span><?php } elseif ($galeriaximagenes->gal_img->getSort() == "DESC") { ?><span class="caret"></span><?php } ?></span></div>
        </div></div></td>
	<?php } ?>
<?php } ?>		
<?php if ($galeriaximagenes->gal_des->Visible) { // gal_des ?>
	<?php if ($galeriaximagenes->SortUrl($galeriaximagenes->gal_des) == "") { ?>
		<td><div id="elh_galeriaximagenes_gal_des" class="galeriaximagenes_gal_des"><div class="ewTableHeaderCaption"><?php echo $galeriaximagenes->gal_des->FldCaption() ?></div></div></td>
	<?php } else { ?>
		<td><div><div id="elh_galeriaximagenes_gal_des" class="galeriaximagenes_gal_des">
			<div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><?php echo $galeriaximagenes->gal_des->FldCaption() ?></span><span class="ewTableHeaderSort"><?php if ($galeriaximagenes->gal_des->getSort() == "ASC") { ?><span class="caret ewSortUp"></span><?php } elseif ($galeriaximagenes->gal_des->getSort() == "DESC") { ?><span class="caret"></span><?php } ?></span></div>
        </div></div></td>
	<?php } ?>
<?php } ?>		
<?php if ($galeriaximagenes->gal_pub->Visible) { // gal_pub ?>
	<?php if ($galeriaximagenes->SortUrl($galeriaximagenes->gal_pub) == "") { ?>
		<td><div id="elh_galeriaximagenes_gal_pub" class="galeriaximagenes_gal_pub"><div class="ewTableHeaderCaption"><?php echo $galeriaximagenes->gal_pub->FldCaption() ?></div></div></td>
	<?php } else { ?>
		<td><div><div id="elh_galeriaximagenes_gal_pub" class="galeriaximagenes_gal_pub">
			<div class="ewTableHeaderBtn"><span class="ewTableHeaderCaption"><?php echo $galeriaximagenes->gal_pub->FldCaption() ?></span><span class="ewTableHeaderSort"><?php if ($galeriaximagenes->gal_pub->getSort() == "ASC") { ?><span class="caret ewSortUp"></span><?php } elseif ($galeriaximagenes->gal_pub->getSort() == "DESC") { ?><span class="caret"></span><?php } ?></span></div>
        </div></div></td>
	<?php } ?>
<?php } ?>		
<?php

// Render list options (header, right)
$galeriaximagenes_grid->ListOptions->Render("header", "right");
?>
	</tr>
</thead>
<tbody>
<?php
$galeriaximagenes_grid->StartRec = 1;
$galeriaximagenes_grid->StopRec = $galeriaximagenes_grid->TotalRecs; // Show all records

// Restore number of post back records
if ($objForm) {
	$objForm->Index = -1;
	if ($objForm->HasValue($galeriaximagenes_grid->FormKeyCountName) && ($galeriaximagenes->CurrentAction == "gridadd" || $galeriaximagenes->CurrentAction == "gridedit" || $galeriaximagenes->CurrentAction == "F")) {
		$galeriaximagenes_grid->KeyCount = $objForm->GetValue($galeriaximagenes_grid->FormKeyCountName);
		$galeriaximagenes_grid->StopRec = $galeriaximagenes_grid->StartRec + $galeriaximagenes_grid->KeyCount - 1;
	}
}
$galeriaximagenes_grid->RecCnt = $galeriaximagenes_grid->StartRec - 1;
if ($galeriaximagenes_grid->Recordset && !$galeriaximagenes_grid->Recordset->EOF) {
	$galeriaximagenes_grid->Recordset->MoveFirst();
	if (!$bSelectLimit && $galeriaximagenes_grid->StartRec > 1)
		$galeriaximagenes_grid->Recordset->Move($galeriaximagenes_grid->StartRec - 1);
} elseif (!$galeriaximagenes->AllowAddDeleteRow && $galeriaximagenes_grid->StopRec == 0) {
	$galeriaximagenes_grid->StopRec = $galeriaximagenes->GridAddRowCount;
}

// Initialize aggregate
$galeriaximagenes->RowType = EW_ROWTYPE_AGGREGATEINIT;
$galeriaximagenes->ResetAttrs();
$galeriaximagenes_grid->RenderRow();
if ($galeriaximagenes->CurrentAction == "gridadd")
	$galeriaximagenes_grid->RowIndex = 0;
if ($galeriaximagenes->CurrentAction == "gridedit")
	$galeriaximagenes_grid->RowIndex = 0;
while ($galeriaximagenes_grid->RecCnt < $galeriaximagenes_grid->StopRec) {
	$galeriaximagenes_grid->RecCnt++;
	if (intval($galeriaximagenes_grid->RecCnt) >= intval($galeriaximagenes_grid->StartRec)) {
		$galeriaximagenes_grid->RowCnt++;
		if ($galeriaximagenes->CurrentAction == "gridadd" || $galeriaximagenes->CurrentAction == "gridedit" || $galeriaximagenes->CurrentAction == "F") {
			$galeriaximagenes_grid->RowIndex++;
			$objForm->Index = $galeriaximagenes_grid->RowIndex;
			if ($objForm->HasValue($galeriaximagenes_grid->FormActionName))
				$galeriaximagenes_grid->RowAction = strval($objForm->GetValue($galeriaximagenes_grid->FormActionName));
			elseif ($galeriaximagenes->CurrentAction == "gridadd")
				$galeriaximagenes_grid->RowAction = "insert";
			else
				$galeriaximagenes_grid->RowAction = "";
		}

		// Set up key count
		$galeriaximagenes_grid->KeyCount = $galeriaximagenes_grid->RowIndex;

		// Init row class and style
		$galeriaximagenes->ResetAttrs();
		$galeriaximagenes->CssClass = "";
		if ($galeriaximagenes->CurrentAction == "gridadd") {
			if ($galeriaximagenes->CurrentMode == "copy") {
				$galeriaximagenes_grid->LoadRowValues($galeriaximagenes_grid->Recordset); // Load row values
				$galeriaximagenes_grid->SetRecordKey($galeriaximagenes_grid->RowOldKey, $galeriaximagenes_grid->Recordset); // Set old record key
			} else {
				$galeriaximagenes_grid->LoadDefaultValues(); // Load default values
				$galeriaximagenes_grid->RowOldKey = ""; // Clear old key value
			}
		} else {
			$galeriaximagenes_grid->LoadRowValues($galeriaximagenes_grid->Recordset); // Load row values
		}
		$galeriaximagenes->RowType = EW_ROWTYPE_VIEW; // Render view
		if ($galeriaximagenes->CurrentAction == "gridadd") // Grid add
			$galeriaximagenes->RowType = EW_ROWTYPE_ADD; // Render add
		if ($galeriaximagenes->CurrentAction == "gridadd" && $galeriaximagenes->EventCancelled && !$objForm->HasValue("k_blankrow")) // Insert failed
			$galeriaximagenes_grid->RestoreCurrentRowFormValues($galeriaximagenes_grid->RowIndex); // Restore form values
		if ($galeriaximagenes->CurrentAction == "gridedit") { // Grid edit
			if ($galeriaximagenes->EventCancelled) {
				$galeriaximagenes_grid->RestoreCurrentRowFormValues($galeriaximagenes_grid->RowIndex); // Restore form values
			}
			if ($galeriaximagenes_grid->RowAction == "insert")
				$galeriaximagenes->RowType = EW_ROWTYPE_ADD; // Render add
			else
				$galeriaximagenes->RowType = EW_ROWTYPE_EDIT; // Render edit
		}
		if ($galeriaximagenes->CurrentAction == "gridedit" && ($galeriaximagenes->RowType == EW_ROWTYPE_EDIT || $galeriaximagenes->RowType == EW_ROWTYPE_ADD) && $galeriaximagenes->EventCancelled) // Update failed
			$galeriaximagenes_grid->RestoreCurrentRowFormValues($galeriaximagenes_grid->RowIndex); // Restore form values
		if ($galeriaximagenes->RowType == EW_ROWTYPE_EDIT) // Edit row
			$galeriaximagenes_grid->EditRowCnt++;
		if ($galeriaximagenes->CurrentAction == "F") // Confirm row
			$galeriaximagenes_grid->RestoreCurrentRowFormValues($galeriaximagenes_grid->RowIndex); // Restore form values

		// Set up row id / data-rowindex
		$galeriaximagenes->RowAttrs = array_merge($galeriaximagenes->RowAttrs, array('data-rowindex'=>$galeriaximagenes_grid->RowCnt, 'id'=>'r' . $galeriaximagenes_grid->RowCnt . '_galeriaximagenes', 'data-rowtype'=>$galeriaximagenes->RowType));

		// Render row
		$galeriaximagenes_grid->RenderRow();

		// Render list options
		$galeriaximagenes_grid->RenderListOptions();

		// Skip delete row / empty row for confirm page
		if ($galeriaximagenes_grid->RowAction <> "delete" && $galeriaximagenes_grid->RowAction <> "insertdelete" && !($galeriaximagenes_grid->RowAction == "insert" && $galeriaximagenes->CurrentAction == "F" && $galeriaximagenes_grid->EmptyRow())) {
?>
	<tr<?php echo $galeriaximagenes->RowAttributes() ?>>
<?php

// Render list options (body, left)
$galeriaximagenes_grid->ListOptions->Render("body", "left", $galeriaximagenes_grid->RowCnt);
?>
	<?php if ($galeriaximagenes->gal_id->Visible) { // gal_id ?>
		<td<?php echo $galeriaximagenes->gal_id->CellAttributes() ?>>
<?php if ($galeriaximagenes->RowType == EW_ROWTYPE_ADD) { // Add record ?>
<input type="hidden" data-field="x_gal_id" name="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_id" id="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_id" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_id->OldValue) ?>">
<?php } ?>
<?php if ($galeriaximagenes->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $galeriaximagenes_grid->RowCnt ?>_galeriaximagenes_gal_id" class="control-group galeriaximagenes_gal_id">
<span<?php echo $galeriaximagenes->gal_id->ViewAttributes() ?>>
<?php echo $galeriaximagenes->gal_id->EditValue ?></span>
</span>
<input type="hidden" data-field="x_gal_id" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_id" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_id" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_id->CurrentValue) ?>">
<?php } ?>
<?php if ($galeriaximagenes->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<span<?php echo $galeriaximagenes->gal_id->ViewAttributes() ?>>
<?php echo $galeriaximagenes->gal_id->ListViewValue() ?></span>
<input type="hidden" data-field="x_gal_id" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_id" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_id" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_id->FormValue) ?>">
<input type="hidden" data-field="x_gal_id" name="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_id" id="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_id" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_id->OldValue) ?>">
<?php } ?>
<a id="<?php echo $galeriaximagenes_grid->PageObjName . "_row_" . $galeriaximagenes_grid->RowCnt ?>"></a></td>
	<?php } ?>
	<?php if ($galeriaximagenes->gal_gal_id->Visible) { // gal_gal_id ?>
		<td<?php echo $galeriaximagenes->gal_gal_id->CellAttributes() ?>>
<?php if ($galeriaximagenes->RowType == EW_ROWTYPE_ADD) { // Add record ?>
<?php if ($galeriaximagenes->gal_gal_id->getSessionValue() <> "") { ?>
<span<?php echo $galeriaximagenes->gal_gal_id->ViewAttributes() ?>>
<?php echo $galeriaximagenes->gal_gal_id->ListViewValue() ?></span>
<input type="hidden" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_gal_id->CurrentValue) ?>">
<?php } else { ?>
<select data-field="x_gal_gal_id" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id"<?php echo $galeriaximagenes->gal_gal_id->EditAttributes() ?>>
<?php
if (is_array($galeriaximagenes->gal_gal_id->EditValue)) {
	$arwrk = $galeriaximagenes->gal_gal_id->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($galeriaximagenes->gal_gal_id->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
if (@$emptywrk) $galeriaximagenes->gal_gal_id->OldValue = "";
?>
</select>
<?php
 $sSqlWrk = "SELECT `gal_id`, `gal_img_pri` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `galerias`";
 $sWhereWrk = "";

 // Call Lookup selecting
 $galeriaximagenes->Lookup_Selecting($galeriaximagenes->gal_gal_id, $sWhereWrk);
 if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
?>
<input type="hidden" name="s_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" id="s_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" value="s=<?php echo ew_Encrypt($sSqlWrk) ?>&amp;f0=<?php echo ew_Encrypt("`gal_id` = {filter_value}"); ?>&amp;t0=3">
<?php } ?>
<input type="hidden" data-field="x_gal_gal_id" name="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" id="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_gal_id->OldValue) ?>">
<?php } ?>
<?php if ($galeriaximagenes->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<?php if ($galeriaximagenes->gal_gal_id->getSessionValue() <> "") { ?>
<span<?php echo $galeriaximagenes->gal_gal_id->ViewAttributes() ?>>
<?php echo $galeriaximagenes->gal_gal_id->ListViewValue() ?></span>
<input type="hidden" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_gal_id->CurrentValue) ?>">
<?php } else { ?>
<select data-field="x_gal_gal_id" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id"<?php echo $galeriaximagenes->gal_gal_id->EditAttributes() ?>>
<?php
if (is_array($galeriaximagenes->gal_gal_id->EditValue)) {
	$arwrk = $galeriaximagenes->gal_gal_id->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($galeriaximagenes->gal_gal_id->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
if (@$emptywrk) $galeriaximagenes->gal_gal_id->OldValue = "";
?>
</select>
<?php
 $sSqlWrk = "SELECT `gal_id`, `gal_img_pri` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `galerias`";
 $sWhereWrk = "";

 // Call Lookup selecting
 $galeriaximagenes->Lookup_Selecting($galeriaximagenes->gal_gal_id, $sWhereWrk);
 if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
?>
<input type="hidden" name="s_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" id="s_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" value="s=<?php echo ew_Encrypt($sSqlWrk) ?>&amp;f0=<?php echo ew_Encrypt("`gal_id` = {filter_value}"); ?>&amp;t0=3">
<?php } ?>
<?php } ?>
<?php if ($galeriaximagenes->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<span<?php echo $galeriaximagenes->gal_gal_id->ViewAttributes() ?>>
<?php echo $galeriaximagenes->gal_gal_id->ListViewValue() ?></span>
<input type="hidden" data-field="x_gal_gal_id" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_gal_id->FormValue) ?>">
<input type="hidden" data-field="x_gal_gal_id" name="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" id="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_gal_id->OldValue) ?>">
<?php } ?>
</td>
	<?php } ?>
	<?php if ($galeriaximagenes->gal_img->Visible) { // gal_img ?>
		<td<?php echo $galeriaximagenes->gal_img->CellAttributes() ?>>
<?php if ($galeriaximagenes_grid->RowAction == "insert") { // Add record ?>
<div id="el<?php echo $galeriaximagenes_grid->RowCnt ?>_galeriaximagenes_gal_img" class="control-group galeriaximagenes_gal_img">
<span id="fd_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img">
<span class="btn btn-small fileinput-button"<?php if ($galeriaximagenes->gal_img->ReadOnly || $galeriaximagenes->gal_img->Disabled) echo " style=\"display: none;\""; ?>>
	<span><?php echo $Language->Phrase("ChooseFile") ?></span>
	<input type="file" data-field="x_gal_img" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img">
</span>
<input type="hidden" name="fn_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" id= "fn_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" value="<?php echo $galeriaximagenes->gal_img->Upload->FileName ?>">
<input type="hidden" name="fa_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" id= "fa_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" value="0">
<input type="hidden" name="fs_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" id= "fs_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" value="70">
</span>
<table id="ft_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" class="table table-condensed pull-left ewUploadTable"><tbody class="files"></tbody></table>
</div>
<input type="hidden" data-field="x_gal_img" name="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" id="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_img->OldValue) ?>">
<?php } elseif ($galeriaximagenes->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<span<?php echo $galeriaximagenes->gal_img->ViewAttributes() ?>>
<?php if ($galeriaximagenes->gal_img->LinkAttributes() <> "") { ?>
<?php if (!empty($galeriaximagenes->gal_img->Upload->DbValue)) { ?>
<?php echo $galeriaximagenes->gal_img->ListViewValue() ?>
<?php } elseif (!in_array($galeriaximagenes->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } else { ?>
<?php if (!empty($galeriaximagenes->gal_img->Upload->DbValue)) { ?>
<?php echo $galeriaximagenes->gal_img->ListViewValue() ?>
<?php } elseif (!in_array($galeriaximagenes->CurrentAction, array("I", "edit", "gridedit"))) { ?>	
&nbsp;
<?php } ?>
<?php } ?>
</span>
<?php } else  { // Edit record ?>
<div id="el<?php echo $galeriaximagenes_grid->RowCnt ?>_galeriaximagenes_gal_img" class="control-group galeriaximagenes_gal_img">
<span id="fd_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img">
<span class="btn btn-small fileinput-button"<?php if ($galeriaximagenes->gal_img->ReadOnly || $galeriaximagenes->gal_img->Disabled) echo " style=\"display: none;\""; ?>>
	<span><?php echo $Language->Phrase("ChooseFile") ?></span>
	<input type="file" data-field="x_gal_img" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img">
</span>
<input type="hidden" name="fn_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" id= "fn_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" value="<?php echo $galeriaximagenes->gal_img->Upload->FileName ?>">
<?php if (@$_POST["fa_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img"] == "0") { ?>
<input type="hidden" name="fa_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" id= "fa_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" value="0">
<?php } else { ?>
<input type="hidden" name="fa_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" id= "fa_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" value="1">
<?php } ?>
<input type="hidden" name="fs_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" id= "fs_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" value="70">
</span>
<table id="ft_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" class="table table-condensed pull-left ewUploadTable"><tbody class="files"></tbody></table>
</div>
<?php } ?>
</td>
	<?php } ?>
	<?php if ($galeriaximagenes->gal_des->Visible) { // gal_des ?>
		<td<?php echo $galeriaximagenes->gal_des->CellAttributes() ?>>
<?php if ($galeriaximagenes->RowType == EW_ROWTYPE_ADD) { // Add record ?>
<span id="el<?php echo $galeriaximagenes_grid->RowCnt ?>_galeriaximagenes_gal_des" class="control-group galeriaximagenes_gal_des">
<input type="text" data-field="x_gal_des" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_des" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_des" size="30" maxlength="100" placeholder="<?php echo $galeriaximagenes->gal_des->PlaceHolder ?>" value="<?php echo $galeriaximagenes->gal_des->EditValue ?>"<?php echo $galeriaximagenes->gal_des->EditAttributes() ?>>
</span>
<input type="hidden" data-field="x_gal_des" name="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_des" id="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_des" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_des->OldValue) ?>">
<?php } ?>
<?php if ($galeriaximagenes->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $galeriaximagenes_grid->RowCnt ?>_galeriaximagenes_gal_des" class="control-group galeriaximagenes_gal_des">
<input type="text" data-field="x_gal_des" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_des" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_des" size="30" maxlength="100" placeholder="<?php echo $galeriaximagenes->gal_des->PlaceHolder ?>" value="<?php echo $galeriaximagenes->gal_des->EditValue ?>"<?php echo $galeriaximagenes->gal_des->EditAttributes() ?>>
</span>
<?php } ?>
<?php if ($galeriaximagenes->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<span<?php echo $galeriaximagenes->gal_des->ViewAttributes() ?>>
<?php echo $galeriaximagenes->gal_des->ListViewValue() ?></span>
<input type="hidden" data-field="x_gal_des" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_des" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_des" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_des->FormValue) ?>">
<input type="hidden" data-field="x_gal_des" name="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_des" id="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_des" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_des->OldValue) ?>">
<?php } ?>
</td>
	<?php } ?>
	<?php if ($galeriaximagenes->gal_pub->Visible) { // gal_pub ?>
		<td<?php echo $galeriaximagenes->gal_pub->CellAttributes() ?>>
<?php if ($galeriaximagenes->RowType == EW_ROWTYPE_ADD) { // Add record ?>
<span id="el<?php echo $galeriaximagenes_grid->RowCnt ?>_galeriaximagenes_gal_pub" class="control-group galeriaximagenes_gal_pub">
<div id="tp_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME; ?>"><input type="checkbox" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub[]" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub[]" value="{value}"<?php echo $galeriaximagenes->gal_pub->EditAttributes() ?>></div>
<div id="dsl_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub" data-repeatcolumn="5" class="ewItemList">
<?php
$arwrk = $galeriaximagenes->gal_pub->EditValue;
if (is_array($arwrk)) {
	$armultiwrk= explode(",", strval($galeriaximagenes->gal_pub->CurrentValue));
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = "";
		$cnt = count($armultiwrk);
		for ($ari = 0; $ari < $cnt; $ari++) {
			if (strval($arwrk[$rowcntwrk][0]) == trim(strval($armultiwrk[$ari]))) {
				$selwrk = " checked=\"checked\"";
				if ($selwrk <> "") $emptywrk = FALSE;
				break;
			}
		}

		// Note: No spacing within the LABEL tag
?>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 1) ?>
<label class="checkbox"><input type="checkbox" data-field="x_gal_pub" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub[]" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub_<?php echo $rowcntwrk ?>[]" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $galeriaximagenes->gal_pub->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
	}
}
if (@$emptywrk) $galeriaximagenes->gal_pub->OldValue = "";
?>
</div>
</span>
<input type="hidden" data-field="x_gal_pub" name="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub[]" id="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub[]" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_pub->OldValue) ?>">
<?php } ?>
<?php if ($galeriaximagenes->RowType == EW_ROWTYPE_EDIT) { // Edit record ?>
<span id="el<?php echo $galeriaximagenes_grid->RowCnt ?>_galeriaximagenes_gal_pub" class="control-group galeriaximagenes_gal_pub">
<div id="tp_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME; ?>"><input type="checkbox" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub[]" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub[]" value="{value}"<?php echo $galeriaximagenes->gal_pub->EditAttributes() ?>></div>
<div id="dsl_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub" data-repeatcolumn="5" class="ewItemList">
<?php
$arwrk = $galeriaximagenes->gal_pub->EditValue;
if (is_array($arwrk)) {
	$armultiwrk= explode(",", strval($galeriaximagenes->gal_pub->CurrentValue));
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = "";
		$cnt = count($armultiwrk);
		for ($ari = 0; $ari < $cnt; $ari++) {
			if (strval($arwrk[$rowcntwrk][0]) == trim(strval($armultiwrk[$ari]))) {
				$selwrk = " checked=\"checked\"";
				if ($selwrk <> "") $emptywrk = FALSE;
				break;
			}
		}

		// Note: No spacing within the LABEL tag
?>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 1) ?>
<label class="checkbox"><input type="checkbox" data-field="x_gal_pub" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub[]" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub_<?php echo $rowcntwrk ?>[]" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $galeriaximagenes->gal_pub->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
	}
}
if (@$emptywrk) $galeriaximagenes->gal_pub->OldValue = "";
?>
</div>
</span>
<?php } ?>
<?php if ($galeriaximagenes->RowType == EW_ROWTYPE_VIEW) { // View record ?>
<span<?php echo $galeriaximagenes->gal_pub->ViewAttributes() ?>>
<?php echo $galeriaximagenes->gal_pub->ListViewValue() ?></span>
<input type="hidden" data-field="x_gal_pub" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_pub->FormValue) ?>">
<input type="hidden" data-field="x_gal_pub" name="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub[]" id="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub[]" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_pub->OldValue) ?>">
<?php } ?>
</td>
	<?php } ?>
<?php

// Render list options (body, right)
$galeriaximagenes_grid->ListOptions->Render("body", "right", $galeriaximagenes_grid->RowCnt);
?>
	</tr>
<?php if ($galeriaximagenes->RowType == EW_ROWTYPE_ADD || $galeriaximagenes->RowType == EW_ROWTYPE_EDIT) { ?>
<script type="text/javascript">
fgaleriaximagenesgrid.UpdateOpts(<?php echo $galeriaximagenes_grid->RowIndex ?>);
</script>
<?php } ?>
<?php
	}
	} // End delete row checking
	if ($galeriaximagenes->CurrentAction <> "gridadd" || $galeriaximagenes->CurrentMode == "copy")
		if (!$galeriaximagenes_grid->Recordset->EOF) $galeriaximagenes_grid->Recordset->MoveNext();
}
?>
<?php
	if ($galeriaximagenes->CurrentMode == "add" || $galeriaximagenes->CurrentMode == "copy" || $galeriaximagenes->CurrentMode == "edit") {
		$galeriaximagenes_grid->RowIndex = '$rowindex$';
		$galeriaximagenes_grid->LoadDefaultValues();

		// Set row properties
		$galeriaximagenes->ResetAttrs();
		$galeriaximagenes->RowAttrs = array_merge($galeriaximagenes->RowAttrs, array('data-rowindex'=>$galeriaximagenes_grid->RowIndex, 'id'=>'r0_galeriaximagenes', 'data-rowtype'=>EW_ROWTYPE_ADD));
		ew_AppendClass($galeriaximagenes->RowAttrs["class"], "ewTemplate");
		$galeriaximagenes->RowType = EW_ROWTYPE_ADD;

		// Render row
		$galeriaximagenes_grid->RenderRow();

		// Render list options
		$galeriaximagenes_grid->RenderListOptions();
		$galeriaximagenes_grid->StartRowCnt = 0;
?>
	<tr<?php echo $galeriaximagenes->RowAttributes() ?>>
<?php

// Render list options (body, left)
$galeriaximagenes_grid->ListOptions->Render("body", "left", $galeriaximagenes_grid->RowIndex);
?>
	<?php if ($galeriaximagenes->gal_id->Visible) { // gal_id ?>
		<td>
<?php if ($galeriaximagenes->CurrentAction <> "F") { ?>
<?php } else { ?>
<span id="el$rowindex$_galeriaximagenes_gal_id" class="control-group galeriaximagenes_gal_id">
<span<?php echo $galeriaximagenes->gal_id->ViewAttributes() ?>>
<?php echo $galeriaximagenes->gal_id->ViewValue ?></span>
</span>
<input type="hidden" data-field="x_gal_id" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_id" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_id" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_id->FormValue) ?>">
<?php } ?>
<input type="hidden" data-field="x_gal_id" name="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_id" id="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_id" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_id->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($galeriaximagenes->gal_gal_id->Visible) { // gal_gal_id ?>
		<td>
<?php if ($galeriaximagenes->CurrentAction <> "F") { ?>
<?php if ($galeriaximagenes->gal_gal_id->getSessionValue() <> "") { ?>
<span<?php echo $galeriaximagenes->gal_gal_id->ViewAttributes() ?>>
<?php echo $galeriaximagenes->gal_gal_id->ListViewValue() ?></span>
<input type="hidden" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_gal_id->CurrentValue) ?>">
<?php } else { ?>
<select data-field="x_gal_gal_id" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id"<?php echo $galeriaximagenes->gal_gal_id->EditAttributes() ?>>
<?php
if (is_array($galeriaximagenes->gal_gal_id->EditValue)) {
	$arwrk = $galeriaximagenes->gal_gal_id->EditValue;
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = (strval($galeriaximagenes->gal_gal_id->CurrentValue) == strval($arwrk[$rowcntwrk][0])) ? " selected=\"selected\"" : "";
		if ($selwrk <> "") $emptywrk = FALSE;
?>
<option value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?>>
<?php echo $arwrk[$rowcntwrk][1] ?>
</option>
<?php
	}
}
if (@$emptywrk) $galeriaximagenes->gal_gal_id->OldValue = "";
?>
</select>
<?php
 $sSqlWrk = "SELECT `gal_id`, `gal_img_pri` AS `DispFld`, '' AS `Disp2Fld`, '' AS `Disp3Fld`, '' AS `Disp4Fld` FROM `galerias`";
 $sWhereWrk = "";

 // Call Lookup selecting
 $galeriaximagenes->Lookup_Selecting($galeriaximagenes->gal_gal_id, $sWhereWrk);
 if ($sWhereWrk <> "") $sSqlWrk .= " WHERE " . $sWhereWrk;
?>
<input type="hidden" name="s_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" id="s_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" value="s=<?php echo ew_Encrypt($sSqlWrk) ?>&amp;f0=<?php echo ew_Encrypt("`gal_id` = {filter_value}"); ?>&amp;t0=3">
<?php } ?>
<?php } else { ?>
<span<?php echo $galeriaximagenes->gal_gal_id->ViewAttributes() ?>>
<?php echo $galeriaximagenes->gal_gal_id->ViewValue ?></span>
<input type="hidden" data-field="x_gal_gal_id" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_gal_id->FormValue) ?>">
<?php } ?>
<input type="hidden" data-field="x_gal_gal_id" name="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" id="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_gal_id" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_gal_id->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($galeriaximagenes->gal_img->Visible) { // gal_img ?>
		<td>
<div id="el$rowindex$_galeriaximagenes_gal_img" class="control-group galeriaximagenes_gal_img">
<span id="fd_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img">
<span class="btn btn-small fileinput-button"<?php if ($galeriaximagenes->gal_img->ReadOnly || $galeriaximagenes->gal_img->Disabled) echo " style=\"display: none;\""; ?>>
	<span><?php echo $Language->Phrase("ChooseFile") ?></span>
	<input type="file" data-field="x_gal_img" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img">
</span>
<input type="hidden" name="fn_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" id= "fn_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" value="<?php echo $galeriaximagenes->gal_img->Upload->FileName ?>">
<input type="hidden" name="fa_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" id= "fa_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" value="0">
<input type="hidden" name="fs_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" id= "fs_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" value="70">
</span>
<table id="ft_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" class="table table-condensed pull-left ewUploadTable"><tbody class="files"></tbody></table>
</div>
<input type="hidden" data-field="x_gal_img" name="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" id="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_img" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_img->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($galeriaximagenes->gal_des->Visible) { // gal_des ?>
		<td>
<?php if ($galeriaximagenes->CurrentAction <> "F") { ?>
<span id="el$rowindex$_galeriaximagenes_gal_des" class="control-group galeriaximagenes_gal_des">
<input type="text" data-field="x_gal_des" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_des" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_des" size="30" maxlength="100" placeholder="<?php echo $galeriaximagenes->gal_des->PlaceHolder ?>" value="<?php echo $galeriaximagenes->gal_des->EditValue ?>"<?php echo $galeriaximagenes->gal_des->EditAttributes() ?>>
</span>
<?php } else { ?>
<span id="el$rowindex$_galeriaximagenes_gal_des" class="control-group galeriaximagenes_gal_des">
<span<?php echo $galeriaximagenes->gal_des->ViewAttributes() ?>>
<?php echo $galeriaximagenes->gal_des->ViewValue ?></span>
</span>
<input type="hidden" data-field="x_gal_des" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_des" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_des" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_des->FormValue) ?>">
<?php } ?>
<input type="hidden" data-field="x_gal_des" name="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_des" id="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_des" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_des->OldValue) ?>">
</td>
	<?php } ?>
	<?php if ($galeriaximagenes->gal_pub->Visible) { // gal_pub ?>
		<td>
<?php if ($galeriaximagenes->CurrentAction <> "F") { ?>
<span id="el$rowindex$_galeriaximagenes_gal_pub" class="control-group galeriaximagenes_gal_pub">
<div id="tp_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub" class="<?php echo EW_ITEM_TEMPLATE_CLASSNAME; ?>"><input type="checkbox" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub[]" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub[]" value="{value}"<?php echo $galeriaximagenes->gal_pub->EditAttributes() ?>></div>
<div id="dsl_x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub" data-repeatcolumn="5" class="ewItemList">
<?php
$arwrk = $galeriaximagenes->gal_pub->EditValue;
if (is_array($arwrk)) {
	$armultiwrk= explode(",", strval($galeriaximagenes->gal_pub->CurrentValue));
	$rowswrk = count($arwrk);
	$emptywrk = TRUE;
	for ($rowcntwrk = 0; $rowcntwrk < $rowswrk; $rowcntwrk++) {
		$selwrk = "";
		$cnt = count($armultiwrk);
		for ($ari = 0; $ari < $cnt; $ari++) {
			if (strval($arwrk[$rowcntwrk][0]) == trim(strval($armultiwrk[$ari]))) {
				$selwrk = " checked=\"checked\"";
				if ($selwrk <> "") $emptywrk = FALSE;
				break;
			}
		}

		// Note: No spacing within the LABEL tag
?>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 1) ?>
<label class="checkbox"><input type="checkbox" data-field="x_gal_pub" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub[]" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub_<?php echo $rowcntwrk ?>[]" value="<?php echo ew_HtmlEncode($arwrk[$rowcntwrk][0]) ?>"<?php echo $selwrk ?><?php echo $galeriaximagenes->gal_pub->EditAttributes() ?>><?php echo $arwrk[$rowcntwrk][1] ?></label>
<?php echo ew_RepeatColumnTable($rowswrk, $rowcntwrk, 5, 2) ?>
<?php
	}
}
if (@$emptywrk) $galeriaximagenes->gal_pub->OldValue = "";
?>
</div>
</span>
<?php } else { ?>
<span id="el$rowindex$_galeriaximagenes_gal_pub" class="control-group galeriaximagenes_gal_pub">
<span<?php echo $galeriaximagenes->gal_pub->ViewAttributes() ?>>
<?php echo $galeriaximagenes->gal_pub->ViewValue ?></span>
</span>
<input type="hidden" data-field="x_gal_pub" name="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub" id="x<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_pub->FormValue) ?>">
<?php } ?>
<input type="hidden" data-field="x_gal_pub" name="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub[]" id="o<?php echo $galeriaximagenes_grid->RowIndex ?>_gal_pub[]" value="<?php echo ew_HtmlEncode($galeriaximagenes->gal_pub->OldValue) ?>">
</td>
	<?php } ?>
<?php

// Render list options (body, right)
$galeriaximagenes_grid->ListOptions->Render("body", "right", $galeriaximagenes_grid->RowCnt);
?>
<script type="text/javascript">
fgaleriaximagenesgrid.UpdateOpts(<?php echo $galeriaximagenes_grid->RowIndex ?>);
</script>
	</tr>
<?php
}
?>
</tbody>
</table>
<?php if ($galeriaximagenes->CurrentMode == "add" || $galeriaximagenes->CurrentMode == "copy") { ?>
<input type="hidden" name="a_list" id="a_list" value="gridinsert">
<input type="hidden" name="<?php echo $galeriaximagenes_grid->FormKeyCountName ?>" id="<?php echo $galeriaximagenes_grid->FormKeyCountName ?>" value="<?php echo $galeriaximagenes_grid->KeyCount ?>">
<?php echo $galeriaximagenes_grid->MultiSelectKey ?>
<?php } ?>
<?php if ($galeriaximagenes->CurrentMode == "edit") { ?>
<input type="hidden" name="a_list" id="a_list" value="gridupdate">
<input type="hidden" name="<?php echo $galeriaximagenes_grid->FormKeyCountName ?>" id="<?php echo $galeriaximagenes_grid->FormKeyCountName ?>" value="<?php echo $galeriaximagenes_grid->KeyCount ?>">
<?php echo $galeriaximagenes_grid->MultiSelectKey ?>
<?php } ?>
<?php if ($galeriaximagenes->CurrentMode == "") { ?>
<input type="hidden" name="a_list" id="a_list" value="">
<?php } ?>
<input type="hidden" name="detailpage" value="fgaleriaximagenesgrid">
</div>
<?php

// Close recordset
if ($galeriaximagenes_grid->Recordset)
	$galeriaximagenes_grid->Recordset->Close();
?>
<?php if ($galeriaximagenes_grid->ShowOtherOptions) { ?>
<div class="ewGridLowerPanel ewListOtherOptions">
<?php
	foreach ($galeriaximagenes_grid->OtherOptions as &$option)
		$option->Render("body", "bottom");
?>
</div>
<?php } ?>
</div>
</td></tr></table>
<?php if ($galeriaximagenes->Export == "") { ?>
<script type="text/javascript">
fgaleriaximagenesgrid.Init();
<?php if (EW_MOBILE_REFLOW && ew_IsMobile()) { ?>
ew_Reflow();
<?php } ?>
</script>
<?php } ?>
<?php
$galeriaximagenes_grid->ShowPageFooter();
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
?>
<?php
$galeriaximagenes_grid->Page_Terminate();
?>
